import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from game.client.gui.text import *
from game.client.gui.container import *

class GuiManager:
    def __init__(self, width, height):
        self.root = Container(width=width, height=height)
        self.root.validate()

    def add_widget(self, widget):
        self.root.add_child(widget)

    def event(self, event, ms):
        self.root.event(event, ms)

    def update(self, ms):
        self.root.update(ms)

    def blah(self):
        glClear(GL_DEPTH_BUFFER_BIT)

    def draw(self):
        glPushMatrix()
        glMatrixMode(GL_MODELVIEW)
        glLoadIdentity()
        glMatrixMode(GL_PROJECTION)
        glPushMatrix()
        glLoadIdentity()
        gluOrtho2D(0, self.root.pos.width(), self.root.pos.height(), 0)
        self.root.draw()
        glPopMatrix()
        glMatrixMode(GL_MODELVIEW)
        glPopMatrix()
        